package com.tlgen.service;

import com.tlgen.mapper.InstituteMapper;
import com.tlgen.model.Institute;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author: tlgen
 * @Discription:
 */
@Service
public class InstituteService {

    @Autowired
    InstituteMapper instituteMapper;

    public List<Institute> getAllInstitutes() {
        return instituteMapper.getAllInstitutes();
    }

    public Integer addInstitute(Institute institute) {
        institute.setCreateDate(new Date());
        institute.setEnabled(true);
        return instituteMapper.insertSelective(institute);
    }

    public Integer updateInstitute(Institute institute) {
        return instituteMapper.updateByPrimaryKeySelective(institute);
    }

    public Integer deleteInstituteById(Integer id) {
        return instituteMapper.deleteByPrimaryKey(id);
    }

    public Integer deleteInstituteByIds(Integer[] ids) {
        return instituteMapper.deleteInstituteByIds(ids);
    }
}
